package org.anyin.gitee.cloud.center.cdms.controller;

import org.anyin.gitee.cloud.center.cdms.controller.form.CsInfoRegisterForm;
import org.anyin.gitee.cloud.center.cdms.convert.CsInfoConvert;
import org.anyin.gitee.cloud.center.cdms.service.CsInfoService;
import org.anyin.gitee.cloud.center.cdms.service.dto.CsInfoRegisterDTO;
import org.anyin.gitee.cloud.center.cdms.service.dto.CsWxInfoDTO;
import org.anyin.gitee.cloud.lib.core.web.ApiResponse;
import org.anyin.gitee.cloud.lib.core.web.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/cs-info")
public class CsInfoController extends BaseController {

    @Autowired
    private CsInfoService csInfoService;

    @Autowired
    private CsInfoConvert csInfoConvert;
    /**
     * 注册
     */
    @PostMapping("/register")
    public ApiResponse<CsWxInfoDTO> register(@RequestBody CsInfoRegisterForm form){
        CsInfoRegisterDTO param = csInfoConvert.getCsInfoRegisterDTO(form);
        CsWxInfoDTO info = csInfoService.register(param);
        return ApiResponse.success(info);
    }
}
